<script>
  var oddEvenList = function(head) {
    let x = head;
    let y = head.next;
    let flag = head.next;
    while(y.next !== null && y !== null){
      x.next = x.next.next;
      x = x.next;
      y.next = y.next.next;
      y = y.next;
    }
    x.next = flag;
    return head;
  };
</script>